<?php
class UserWeiboAction extends UserAction
{
	public function __construct()
	{
		parent::__construct();
		$this->responseType = 'json';
	}
	
	public function execute()
	{
		$this->code 	= 0;
		$content 		= $this->context->post('content');
		if (!$content){
			$this->code 	= 101;
			return;
		}
		$data = array(
			'content'=>$content,
			'user_id'=>$this->data['user']['id'],
		);
		$weiboService	= new WeiboService();
		if ($weiboService->addData($data)){
			$this->code = 200;
			$created = Util::getBeforeTimelag(time());
			$this->data['home'] = C('LtUrl')->generate('User','Index', array('uid'=>$this->data['user']['id']));
			$this->data['logo'] = $this->data['user']['logo'];
			$this->data['username'] = $this->data['user']['username'];
			$this->data['content'] = $content;
			$this->data['created'] = $created;
		}
		
	}
}
